<?php
	
	session_start();
	require("connect.php");
	$link = connect_APO();

	require("check.php");
	is_logged_in();
	is_admin();
	
	
	require("header+logoutB.php");
	headerL();
	
	//select number to add, display fields
	$numberToAdd = $_GET['numNew'];
	
	echo "<html>
<body class='main'>

<FONT class='mainFont'>
  <CENTER>
    <!--<p><img src = 'images/apopic.jpg'></p>-->
    <br>
	<br>
	  <div class='headerTable'>
	  <div id='links'>
	  <div id='backLink'> <A href='usersAdmin.php'>Back to Users Administration</A></div></div>
	  <b class='b1f'></b><b class='b2f'></b><b class='b3f'></b><b class='b4f'></b>
	  <div class='contentf'>
		  <div class = 'headerText'>
				Add Users:
		  </div>
		  <div class='pad5'>Use this page to add users (brothers and/or pledges) to the online midweeks system. If you want to make a brother a midweek leader,
		  use <a href='midweeks.php'>this</a> page (edit the midweek you want the brother to be a midweek leader of). There are two ways of adding users to this site. The first option is to add brothers manually through the text boxes below (useful if you only have a couple of people to add). The other option is to upload a .CSV (comma separated value) file of the roster which will automatically add all the brothers in the file to the site. </div>
		  <div id='addUsersT'><font size='2'>1) Manually add users:</font></div>
		  <div class='pad5'><form action='addUserInt.php' method='post'>
				<label for='number'>Select the number of Users you would like to add at one time, and the form below will adjust accordingly. WARNING: The form below
		  will be cleared. </label>
				<select name='number'>";
					for ($i=1; $i<=50; $i+=1){
						echo "<option value=$i>$i</option>
						";
					}
				echo "</select>
				<input class='loginButton' type='submit' value='Change'/></form>
		  </div>
		  <div id='addUsersT'><font size='2'>Add users:</font></div>
		  <div id='addULabels'><div id='labelid'>ID</div><div id='labelfn'>First Name</div><div id='labelln'>Last Name</div><div id='labelp'>Phone #</div><div id='labels'>Status</div></div>
		  <form action='addUsersToDB.php?numNew=$numberToAdd' method='post'>
		  ";
		  
		  for($i=0; $i<$numberToAdd; $i+=1){
			echo "<div id='addUFields'>
			<div id='auid'><input class='auidField' type='text' id='id' name='id".$i."'/></div>
			<div id='aufname'><input type='text' id='fname' name='fname".$i."'/></div>
			<div id='aulname'><input type='text' id='lname' name='lname".$i."'/></div>
			<div id='auphone'><input type='text' id='phone' name='phone".$i."'/></div>
			<div id='austatus'><input type='text' id='status' name='status".$i."'/></div></div>";
		  }
	  echo " <div class='pad5'><input class='loginButton' type='submit' value='Submit'/></form>
		
	  </div>
	  <div id='addUsersT'><font size='2'> 2) Upload .CSV version of roster:</font></div>
		<div class='pad5'>
		<label for='upload'>To convert the roster into a .CSV file, open up the excel spreadsheet roster, something like \"APO Fall Roster 2008.xls\". Once you have that file open, click on the little Orb thing in the top left (appearently its called the Office Button), then click on \"Save As\". This will bring up the \"Save As\" window where you will now want to change the \"Save as type\" to \"CSV (comma delimited) (*.csv)\". Once that is changed you can click save. If any error messages pop up click \"Yes\" or \"Ok\" to continue. Once you are done here, you have now made a .CSV file which can be uploaded to this site. Just click the browse button below and locate your file and click ok, and then upload and everything should work... hopefully :-P</label>
		<form id='upload' enctype='multipart/form-data' action='upload.php' method='POST'>
		<input type='hidden' name='MAX_FILE_SIZE' value='100000' />
Choose a file to upload: <input name='uploadedfile' type='file' /><br />
<input type='submit' name='upload' value='Upload File' />
	</form>
	  </div>
	  <b class='b4f'></b><b class='b3f'></b><b class='b2f'></b><b class='b1f'></b></div>
  </CENTER>
</FONT>
</body>
</html>";

	require("footer.php");
	footer();
mysql_close($link);
?>
